<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "user".
 *
 * @property int $id
 * @property string $name 用户名
 * @property string $password 密码
 * @property string $email 邮箱
 * @property int $status 1是正常，2是非正常
 * @property int $is_admin 1是管理员，0不是管理员
 * @property string $create_time 创建时间
 * @property string $update_time 更新时间
 */
class User extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */

    public static function tableName()
    {
        return 'user';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['name', 'password', 'email'], 'required'],
            [['status', 'is_admin'], 'integer'],
            [['create_time', 'update_time'], 'safe'],
            [['name'], 'string', 'max' => 50],
            [['password'], 'string', 'max' => 255],
            [['email'], 'string', 'max' => 30],
            ['email','email',
                'skipOnEmpty'=>false,
                'skipOnError'=>false,
            ]
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'name' => 'Name',
            'password' => 'Password',
            'email' => 'Email',
            'status' => 'Status',
            'is_admin' => 'Is Admin',
            'create_time' => 'Create Time',
            'update_time' => 'Update Time',
        ];
    }
}
